#!/bin/sh

echo "Web Server"
if [ ! -d "task4" ]; then
	queuecpu=40
	echo $queuecpu
	make clean;
	make;
	mkdir task4
	for rho in 0.1 0.2 0.3 0.4 0.5 0.6 
	do
		echo 'Run' $n 'for rho = '$rho
		for (( queueio = 30; queueio > 1; queueio-- ))
		do
			echo 'I/O queue size ' $queueio
			./queuesimulation $rho $queuecpu $queueio 100000 1 0 >> task4/output_task4
		#		sleep 2
		done
	done
else
	grep 'CPU CLR  =' task4/output_task4 | egrep -o "[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"| awk '{ if (NR%3) printf("%s ", $0); else printf("%s\n", $0);}' > task4/cpu_clr


	grep 'IO one CLR  =' task4/output_task4 | egrep -o "[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"| awk '{ if (NR%3) printf("%s ", $0); else printf("%s\n", $0);}' > task4/io1_clr


	grep 'IO two CLR  =' task4/output_task4 | egrep -o "[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"| awk '{ if (NR%3) printf("%s ", $0); else printf("%s\n", $0);}' > task4/io2_clr


	grep 'IO three CLR  =' task4/output_task4 | egrep -o "[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"| awk '{ if (NR%3) printf("%s ", $0); else printf("%s\n", $0);}' > task4/io3_clr
fi


